<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
VigCrack (JGenere - Initial Port v0.3 r2010.1105)
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="VigCrack (JGenere - Initial Port v0.3 r2010.1105)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM></TD></TR><TR><TD COLSPAN=3><hr />Note: While the cryptography implementations in jgenere.initial_port work correctly according to the provided test cases, they were not optimized or otherwise designed to make use of Java language and platform features.  They are simple ports of the original Python implementation of PyGenere, provided for academic purposes.  Visit the project web site at <a target=_blank href=http://code.google.com/p/jgenere/>http://code.google.com/p/jgenere/</a> for preferred Java-based implementations of these cryptography algorithms.<hr /></TD></TR></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html" title="class in ttpasi.jgenere.initial_port"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../ttpasi/jgenere/initial_port/Vigenere.html" title="class in ttpasi.jgenere.initial_port"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html?ttpasi/jgenere/initial_port/VigCrack.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="VigCrack.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
ttpasi.jgenere.initial_port</FONT>
<BR>
Class VigCrack</H2>
<PRE>
java.lang.Object
  <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>ttpasi.jgenere.initial_port.VigCrack</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <A HREF="../../../src-html/ttpasi/jgenere/initial_port/VigCrack.html#line.336"><B>VigCrack</B></A><DT>extends java.lang.Object</DL>
</PRE>

<P>
Java port of VigCrack from PyGenere v 0.3.  See pygenere.py to learn more 
 about the original PyGenere implementation, including author contact 
 information and licensing and use terms.
 <p/>
 VigCrack objects can crack some cipher keys and messages of Vigenere 
 enciphered messages.  Longer messages are more likely crackable by this 
 algorithm than shorter messages.
 <p/>
 VigCrack objects are immutable.
 <p/>
 Note: This implementation only supports characters in the English alphabet, 
 though multiple languages are supported.
 <p/>
 This typical use sequence cracks a Vigenere encryption key 
 <pre>
 VigCrack vc = new VigCrack(_codedtext);
 String codeword = vc.crackCodeword(new String[] {"5", "9"});
 </pre>
 This typical use sequence cracks a Vigenere encryption key and decrypts the 
 encrypted message
 <pre>
 VigCrack vc = new VigCrack(_codedtext);
 String message = vc.crackMessage(new String[] {"5", "9"});
 </pre>
 See jgenere.initial_port.VigCrackTest source code for further example uses, 
 including how to use VigCrack with different languages.
 <p/>
 Note: While the cryptography implementations in jgenere.initial_port work 
 correctly according to the provided test cases, they were not optimized or 
 otherwise designed to make use of Java language and platform features.  They 
 are simple ports of the original Python implementation of PyGenere, provided 
 for academic purposes.  Visit the project web site at 
 <a target="_blank" href="http://code.google.com/p/jgenere/">http://code.google.com/p/jgenere/</a> 
 for preferred Java-based implementations of these cryptography algorithms.
 <p/>
 The original PyGenere v 0.3 VigCrack code:
 <pre>
 class VigCrack(Vigenere):
 
   """
   VigCrack objects have methods to break Vigenere-encoded texts when the
   original key is unknown.
 
   The technique used is based on the one described in:
 
   http: * www.stonehill.edu/compsci/Shai_papers/RSA.pdf
   (pages 9-10)
 
   Character frequencies taken from:
   http: * www.csm.astate.edu/~rossa/datasec/frequency.html (English)
   http: * www.characterfrequency.com/ (French, Italian, Portuguese, Spanish)
   http: * www.santacruzpl.org/readyref/files/g-l/ltfrqger.shtml (German)
   """
 
   # Unless otherwise specified, test for codewords between (and including)
   # these two lengths:
   __default_min_codeword_length = 5
   __default_max_codeword_length = 9
 
   # The following are language-specific data on character frequencies.
   # Kappa is the "index of coincidence" described in the cryptography paper
   # (link above).
   __english_data = {
                     'A':8.167, 'B':1.492, 'C':2.782, 'D':4.253, 'E':12.702,
                     'F':2.228, 'G':2.015, 'H':6.094, 'I':6.996, 'J':0.153,
                     'K':0.772, 'L':4.025, 'M':2.406, 'N':6.749, 'O':7.507,
                     'P':1.929, 'Q':0.095, 'R':5.987, 'S':6.327, 'T':9.056,
                     'U':2.758, 'V':0.978, 'W':2.360, 'X':0.150, 'Y':1.974,
                     'Z':0.074, 'max_val':12.702, 'kappa':0.0667
                    }
 
   __french_data = {
                    'A':8.11, 'B':0.903, 'C':3.49, 'D':4.27, 'E':17.22,
                    'F':1.14, 'G':1.09, 'H':0.769, 'I':7.44, 'J':0.339,
                    'K':0.097, 'L':5.53, 'M':2.89, 'N':7.46, 'O':5.38,
                    'P':3.02, 'Q':0.999, 'R':7.05, 'S':8.04, 'T':6.99,
                    'U':5.65, 'V':1.30, 'W':0.039, 'X':0.435, 'Y':0.271,
                    'Z':0.098, 'max_val':17.22, 'kappa':0.0746
                   }
 
   __german_data = {
                    'A':6.506, 'B':2.566, 'C':2.837, 'D':5.414, 'E':16.693,
                    'F':2.044, 'G':3.647, 'H':4.064, 'I':7.812, 'J':0.191,
                    'K':1.879, 'L':2.825, 'M':3.005, 'N':9.905, 'O':2.285,
                    'P':0.944, 'Q':0.055, 'R':6.539, 'S':6.765, 'T':6.742,
                    'U':3.703, 'V':1.069, 'W':1.396, 'X':0.022, 'Y':0.032,
                    'Z':1.002, 'max_val':16.693, 'kappa':0.0767
                   }
 
   __italian_data = {
                     'A':11.30, 'B':0.975, 'C':4.35, 'D':3.80, 'E':11.24,
                     'F':1.09, 'G':1.73, 'H':1.02, 'I':11.57, 'J':0.035,
                     'K':0.078, 'L':6.40, 'M':2.66, 'N':7.29, 'O':9.11,
                     'P':2.89, 'Q':0.391, 'R':6.68, 'S':5.11, 'T':6.76,
                     'U':3.18, 'V':1.52, 'W':0.00, 'X':0.024, 'Y':0.048,
                     'Z':0.958, 'max_val':11.57, 'kappa':0.0733
                    }
 
   __portuguese_data = {
                        'A':13.89, 'B':0.980, 'C':4.18, 'D':5.24, 'E':12.72,
                        'F':1.01, 'G':1.17, 'H':0.905, 'I':6.70, 'J':0.317,
                        'K':0.0174, 'L':2.76, 'M':4.54, 'N':5.37, 'O':10.90,
                        'P':2.74, 'Q':1.06, 'R':6.67, 'S':7.90, 'T':4.63,
                        'U':4.05, 'V':1.55, 'W':0.0104, 'X':0.272, 'Y':0.0165,
                        'Z':0.400, 'max_val':13.89, 'kappa':0.0745
                       }
 
   __spanish_data = {
                     'A':12.09, 'B':1.21, 'C':4.20, 'D':4.65, 'E':13.89,
                     'F':0.642, 'G':1.11, 'H':1.13, 'I':6.38, 'J':0.461,
                     'K':0.038, 'L':5.19, 'M':2.86, 'N':7.23, 'O':9.58,
                     'P':2.74, 'Q':1.37, 'R':6.14, 'S':7.43, 'T':4.49,
                     'U':4.53, 'V':1.05, 'W':0.011, 'X':0.124, 'Y':1.14,
                     'Z':0.324, 'max_val':13.89, 'kappa':0.0766
                    }
 
   # The default language is set to English.
   __lang = 'EN'
   __lang_data = __english_data
 
   # This method sets the lang (__lang) attribute of a VigCrack object.
   def set_language(self, language):
       self.__lang = language.upper()
       if self.__lang == 'DE':
           self.__lang_data = self.__german_data
       elif self.__lang == 'ES':
           self.__lang_data = self.__spanish_data
       elif self.__lang == 'FR':
           self.__lang_data = self.__french_data
       elif self.__lang == 'IT':
           self.__lang_data = self.__italian_data
       elif self.__lang == 'PT':
           self.__lang_data = self.__portuguese_data
       else:
           self.__lang = 'EN'
       return self
 
   # Rotate text n places to the right, wrapping around at the end.
   def __rotate_right(self, n):
       cutting_point = len(self) - (n % len(self))
       return self[cutting_point:] + self[:cutting_point]
 
   # Get every nth char from a piece of text, from a given starting position.
   def __get_every_nth_char(self, start, n):
       accumulator = []
       for i in range(len(self)):
           if (i % n) == start:
               accumulator.append(self[i])
       return VigCrack(''.join(accumulator)).set_language(self.__lang)
 
   # Build a dictionary containing the number of occurrences of each char.
   def __count_char_freqs(self):
       dictionary = {}
       self = self.upper()
       for char in self:
           if char.isalpha():
               dictionary[char] = dictionary.get(char, 0) + 1
       return dictionary
 
   # Scale the dictionary so that it can be compared with __lang_data.
   def __scale(self, dictionary):
       v = dictionary.values()
       v.sort()
       max_val = v[-1]
       scaling_factor = self.__lang_data['max_val']/max_val
       for (k, v) in dictionary.items():
           dictionary[k] = v*scaling_factor
       return dictionary
 
   # The residual error is the difference between a char's frequency in
   # __lang_data and its frequency in the scaled dictionary from above.
   # The error is then squared to remove a possible negative value.
   def __sum_residuals_squared(self, dictionary):
       sum = 0
       for (k, v) in dictionary.items():
           sum += (v - self.__lang_data[k])**2
       return sum
 
   # Find the Caesar shift that brings the ciphertext closest to the
   # character distribution of the plaintext's language.
   def __find_best_caesar_shift(self):
       best = 0
       smallest_sum = -1
       # Find the residual sum for each shift.
       for shift in range(26):
           encoded_text = Caesar(self).encipher(shift)
           vigcrack_obj = VigCrack(encoded_text).set_language(self.__lang)
           char_freqs = vigcrack_obj.__count_char_freqs()
           scaled = vigcrack_obj.__scale(char_freqs)
           current_sum = vigcrack_obj.__sum_residuals_squared(scaled)
           # Keep track of the shift with the lowest residual sum.
           # If there's a tie, the smallest shift wins.
           if smallest_sum == -1:
               smallest_sum = current_sum
           if current_sum < smallest_sum:
               best = shift
               smallest_sum = current_sum
       return best
 
   def __find_codeword_length(self, min_length, max_length):
       codeword_length = min_length
       kappas = []
       # Put the kappa value for each codeword length tested into an array.
       for i in range(min_length, max_length + 1):
           temp = self.__rotate_right(i)
           coincidences = 0
           for j in range(len(self)):
               if temp[j] == self[j]:
                   coincidences += 1
           kappas.append(float(coincidences)/len(self))
       # Find out which value of kappa is closest to the kappa of the
       # plaintext's language.  If there's a tie, the shortest codeword wins.
       smallest_squared_diff = -1
       for i in range((max_length + 1) - min_length):
           current_squared_diff = (self.__lang_data['kappa'] - kappas[i])**2
           if smallest_squared_diff == -1:
               smallest_squared_diff = current_squared_diff
           if current_squared_diff < smallest_squared_diff:
               codeword_length = min_length + i
               smallest_squared_diff = current_squared_diff
       return codeword_length
 
   def __find_codeword(self, min_length, max_length):
       # Strip away invalid chars.
       accumulator = []
       for char in self:
           if char.isalpha():
               accumulator.append(char)
       alpha_only = VigCrack(''.join(accumulator)).set_language(self.__lang)
       codeword_length = alpha_only.__find_codeword_length(min_length,
                                                           max_length)
       # Build the codeword by finding one character at a time.
       codeword = []
       for i in range(codeword_length):
           temp = alpha_only.__get_every_nth_char(i, codeword_length)
           shift = temp.__find_best_caesar_shift()
           if shift == 0:
               codeword.append('A')
           else:
               codeword.append(chr(ord('A') + (26 - shift)))
       return VigCrack(''.join(codeword)).set_language(self.__lang)
 
   def __parse_args(self, *arg_list):
       if len(arg_list) == 0:    # Use default values for codeword length.
           min_length = self.__default_min_codeword_length
           max_length = self.__default_max_codeword_length
       elif len(arg_list) == 1:    # Exact codeword length specified by user.
           min_length = max_length = int(arg_list[0])
       else:    # min_length and max_length given by user.
           min_length = int(arg_list[0])
           max_length = int(arg_list[1])
       # Check for input errors.
       if min_length == max_length:
           if min_length < 1:
               raise InputError('Codeword length is too small')
       else:
           if min_length < 1:
               raise InputError('min_length is too small')
           if max_length < 1:
               raise InputError('max_length is too small')
       if max_length < min_length:
           raise InputError('max_length cannot be shorter than min_length')
       if len(self) == 0:
           raise InputError('Ciphertext is empty')
       if len(self) < max_length:
           raise InputError('Ciphertext is too short')
       # Check that the ciphertext contains at least one valid character.
       has_valid_char = False
       for char in self:
           if char.isalpha():
               has_valid_char = True
               break
       if not has_valid_char:
           raise InputError('No valid characters in ciphertext')
       # If everything's all right, return the min_length and max_length.
       return [min_length, max_length]
 
   def crack_codeword(self, *arg_list):
       """
       Try to find the codeword that encrypted the ciphertext object.
       If no arguments are supplied, codewords between the default minimum
       length and the default maximum length are tried.
       If one integer argument is supplied, only codewords with that length
       will be tried.
       If two integer arguments are given then the first argument is treated
       as a minimum codeword length, and the second argument is treated as a
       maximum codeword length, to try.
       """
       array = self.__parse_args(*arg_list)
       return self.__find_codeword(array[0], array[1])
 
   def crack_message(self, *arg_list):
       """
       Try to decode the ciphertext object.
       This method accepts arguments in the same way as the crack_codeword()
       method.
       """
       codeword = self.crack_codeword(*arg_list)
       return self.decipher(codeword)
 </pre>
<P>

<P>
<DL>
<DT><B>Version:</B></DT>
  <DD>2010.1105</DD>
<DT><B>Author:</B></DT>
  <DD>Bruce [com.gmail @ ProgrammerBruce]</DD>
</DL>
<HR>

<P>

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html#VigCrack(java.lang.String)">VigCrack</A></B>(java.lang.String&nbsp;message)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new VigCrack with an encrypted text message to be deciphered.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html#VigCrack(java.lang.String, java.lang.String)">VigCrack</A></B>(java.lang.String&nbsp;message,
                 java.lang.String&nbsp;language)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new VigCrack with an encrypted text message, in a user 
 specified language, to be deciphered.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html#crackCodeword(java.lang.String[])">crackCodeword</A></B>(java.lang.String[]&nbsp;arg_list)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Attempts to discover the key used to encrypt the internal message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html#crackMessage(java.lang.String[])">crackMessage</A></B>(java.lang.String[]&nbsp;arg_list)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Attempts to discover the plain text message of the internal encrypted 
 message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html#text()">text</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the internal English alphabet text message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html#toString()">toString</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the internal English alphabet text message.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="VigCrack(java.lang.String)"><!-- --></A><H3>
VigCrack</H3>
<PRE>
public <A HREF="../../../src-html/ttpasi/jgenere/initial_port/VigCrack.html#line.348"><B>VigCrack</B></A>(java.lang.String&nbsp;message)</PRE>
<DL>
<DD>Constructs a new VigCrack with an encrypted text message to be deciphered.
 <p/>
 Assumes the message to be deciphered is in English. See 
 <A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html#VigCrack(java.lang.String, java.lang.String)"><CODE>VigCrack(String, String)</CODE></A> for other languages that can be used.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>message</CODE> - The text message to decipher.</DL>
</DL>
<HR>

<A NAME="VigCrack(java.lang.String, java.lang.String)"><!-- --></A><H3>
VigCrack</H3>
<PRE>
public <A HREF="../../../src-html/ttpasi/jgenere/initial_port/VigCrack.html#line.371"><B>VigCrack</B></A>(java.lang.String&nbsp;message,
                java.lang.String&nbsp;language)</PRE>
<DL>
<DD>Constructs a new VigCrack with an encrypted text message, in a user 
 specified language, to be deciphered.
 <p/>
 <code>language</code> is a two character String that indicates which 
 language to use. Possible values for <code>language</code> include:
 <ul>
 <li>EN - for English</li>
 <li>DE - for German</li>
 <li>ES - for Spanish</li>
 <li>FR - for French</li>
 <li>IT - for Italian</li>
 <li>PT - for Portuguese</li>
 </ul>
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>message</CODE> - The text message to decipher.<DD><CODE>language</CODE> - The language of the message.</DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="crackCodeword(java.lang.String[])"><!-- --></A><H3>
crackCodeword</H3>
<PRE>
public java.lang.String <A HREF="../../../src-html/ttpasi/jgenere/initial_port/VigCrack.html#line.822"><B>crackCodeword</B></A>(java.lang.String[]&nbsp;arg_list)</PRE>
<DL>
<DD>Attempts to discover the key used to encrypt the internal message.
 <p/>
 If the provided arg_list is null or empty, then keys with lengths in the 
 range of 5 to 9 (inclusive) are used. Otherwise, arg_list should have  
 either one or two components, and the components should be String 
 representations of integral numbers, e.g., "5", "6". If only one component 
 is provided, only keys of that length are sought.  If two components are 
 provided, then keys with lengths in the range represented by the two 
 components are sought.  For example, if arg_list is {"3", "5"}, then keys 
 with lengths 3, 4, and 5 are sought. The one key that best decrypts the 
 internal encrypted message is used.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>arg_list</CODE> - Optional length range within which to look for the key  
            used to encrypt the internal message.
<DT><B>Returns:</B><DD>The key used to encrypt the internal encrypted message.</DL>
</DD>
</DL>
<HR>

<A NAME="crackMessage(java.lang.String[])"><!-- --></A><H3>
crackMessage</H3>
<PRE>
public java.lang.String <A HREF="../../../src-html/ttpasi/jgenere/initial_port/VigCrack.html#line.855"><B>crackMessage</B></A>(java.lang.String[]&nbsp;arg_list)</PRE>
<DL>
<DD>Attempts to discover the plain text message of the internal encrypted 
 message.
 <p/>
 If the provided arg_list is null or empty, then keys with lengths in the 
 range of 5 to 9 (inclusive) are used. Otherwise, arg_list should have  
 either one or two components, and the components should be String 
 representations of integral numbers, e.g., "5", "6". If only one component 
 is provided, only keys of that length are sought.  If two components are 
 provided, then keys with lengths in the range represented by the two 
 components are sought.  For example, if arg_list is {"3", "5"}, then keys 
 with lengths 3, 4, and 5 are sought. The one key that best decrypts the 
 internal encrypted message is used.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>arg_list</CODE> - Optional length range within which to look for the key  
            used to encrypt the internal message.
<DT><B>Returns:</B><DD>The plain text message, decrypted from the internal encrypted 
            message.</DL>
</DD>
</DL>
<HR>

<A NAME="text()"><!-- --></A><H3>
text</H3>
<PRE>
public java.lang.String <A HREF="../../../src-html/ttpasi/jgenere/initial_port/VigCrack.html#line.866"><B>text</B></A>()</PRE>
<DL>
<DD>Retrieves the internal English alphabet text message.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>The internal English alphabet text message.</DL>
</DD>
</DL>
<HR>

<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public java.lang.String <A HREF="../../../src-html/ttpasi/jgenere/initial_port/VigCrack.html#line.878"><B>toString</B></A>()</PRE>
<DL>
<DD>Retrieves the internal English alphabet text message.  Same behavior as 
 <A HREF="../../../ttpasi/jgenere/initial_port/VigCrack.html#text()"><CODE>text()</CODE></A>.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>The internal English alphabet text message.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM></TD></TR><TR><TD COLSPAN=3><hr />Note: While the cryptography implementations in jgenere.initial_port work correctly according to the provided test cases, they were not optimized or otherwise designed to make use of Java language and platform features.  They are simple ports of the original Python implementation of PyGenere, provided for academic purposes.  Visit the project web site at <a target=_blank href=http://code.google.com/p/jgenere/>http://code.google.com/p/jgenere/</a> for preferred Java-based implementations of these cryptography algorithms.<hr /></TD></TR></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../ttpasi/jgenere/initial_port/Caesar.html" title="class in ttpasi.jgenere.initial_port"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../ttpasi/jgenere/initial_port/Vigenere.html" title="class in ttpasi.jgenere.initial_port"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html?ttpasi/jgenere/initial_port/VigCrack.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="VigCrack.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

</BODY>
</HTML>
